package fi.foyt.cs.persistence.dao.locale;

import javax.persistence.EntityManager;

import fi.foyt.cs.persistence.dao.GenericDAO;
import fi.foyt.cs.persistence.domainmodel.locale.LocaleElement;

public class LocaleElementDAO extends GenericDAO<LocaleElement> {

  public LocaleElement create() {
    EntityManager entityManager = getEntityManager();

    entityManager.getTransaction().begin();
    try {
      LocaleElement localeElement = new LocaleElement();
      entityManager.persist(localeElement);
      entityManager.getTransaction().commit();
      return localeElement;
    } finally {
      if (entityManager.getTransaction().isActive())
        entityManager.getTransaction().rollback();
    }
  }

}
